home *** CD-ROM | disk | FTP | other *** search
- Path: newsgw.mentorg.com!news
- From: paulf@paulf.wv.mentorg.com (Paul Furnanz)
- Newsgroups: comp.lang.c++
- Subject: Re: Vector of abstract classes using STL
- Date: 26 Jan 1996 16:38:45 -0800
- Organization: Mentor Graphics Corp. Wilsonville, OR
- Sender: paulf@paulf.wv.mentorg.com
- Message-ID: <vajivhyv5d6.fsf@paulf.wv.mentorg.com>
- References: <3103699A.79F8@ce.kth.se> <3103DF74.2C71@cs.rpi.edu>
- NNTP-Posting-Host: paulf.wv.mentorg.com
- In-reply-to: Bowden Wise's message of Mon, 22 Jan 1996 11:03:16 -0800
- X-Newsreader: Gnus v5.0.2
-
- >>>>> "Bowden" == Bowden Wise <wiseb@cs.rpi.edu> writes:
-
- >> I think I have to use a vector<Shape*> but does the vector delete
- >> the shape elements when the program finishes?
-
- Bowden> You are correct. The STL does NOT delete the shape elements. The
- Bowden> STL takes care of deleting the elements in the container, but not
- Bowden> what those pointers point to. You can either delete the shapes
- Bowden> yourself before the program terminates.
-
- You could just use ``vector<auto_ptr<Shape>>''. When the vector
- destroys the auto_ptr<Shape>, then the pointed to object will be
- deleted.
- --
- --------
- Paul Furnanz Phone: (503) 685-7000 (ext.1731)
- Mentor Graphics Corporation Email: paul_furnanz@mentorg.com
-